Skip to content

fix: add missing Export-Package to mcp-json-jackson2 and mcp-json-jackson3#911

Merged
Kehrlann merged 1 commit into
modelcontextprotocol:mainfrom
joaodinissf:fix/osgi-export-jackson-modules
May 28, 2026
Merged

fix: add missing Export-Package to mcp-json-jackson2 and mcp-json-jackson3#911
Kehrlann merged 1 commit into
modelcontextprotocol:mainfrom
joaodinissf:fix/osgi-export-jackson-modules

Conversation

@joaodinissf
Copy link
Copy Markdown
Contributor

Add explicit Export-Package directives to the jackson modules so OSGi consumers can access classes directly.

Motivation and Context

PR #779 added bnd configuration to the jackson modules but omitted Export-Package (which mcp-core has). Without it, all packages are bundle-private, which prevents direct instantiation of JacksonMcpJsonMapperSupplier or DefaultJsonSchemaValidator from other bundles — the recommended workaround per #562 since ServiceLoader.load() does not work across OSGi bundle boundaries.

This particularly affects Eclipse PDE and Tycho-based projects, which get compile-time "Access restriction" errors and runtime ClassNotFoundException when referencing classes from these modules.

How Has This Been Tested?

Verified the generated META-INF/MANIFEST.MF after mvn process-classes contains the correct Export-Package header with only the module's own packages. Also tested in an Eclipse PDE project — the patched modules compile and resolve without issues.

Breaking Changes

No.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

🤖 Generated with Claude Code

@joaodinissf joaodinissf changed the title Add missing Export-Package to mcp-json-jackson2 and mcp-json-jackson3 fix: add missing Export-Package to mcp-json-jackson2 and mcp-json-jackson3 Apr 29, 2026
@joaodinissf joaodinissf mentioned this pull request May 13, 2026
9 tasks
@joaodinissf
Copy link
Copy Markdown
Contributor Author

@Kehrlann Would you (or someone in the team) have some time to review this? Thanks a lot in advance.

@joaodinissf
Copy link
Copy Markdown
Contributor Author

Just noticed this seems to address the same concern as #951 (closing #948).

The differences: this PR enumerates the packages each module actually publishes — so no future internal subpackage gets auto-exported — and keeps -noimport:=true to match mcp-core.

Happy to defer to maintainers on which shape to land.

@joaodinissf
Copy link
Copy Markdown
Contributor Author

@chemicL apologies for persisting — could you (or another maintainer) take a look at this? Happy to address any questions/concerns.

@Kehrlann Kehrlann self-assigned this May 28, 2026
@Kehrlann Kehrlann added bug Something isn't working area/client area/server P2 Moderate issues affecting some users, edge cases, potentially valuable feature labels May 28, 2026
Use explicit package names instead of a wildcard glob to avoid
embedding mcp-core classes into the jackson module JARs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Kehrlann Kehrlann force-pushed the fix/osgi-export-jackson-modules branch from 421f4e7 to 5ed8bcc Compare May 28, 2026 08:12
@Kehrlann Kehrlann self-requested a review May 28, 2026 09:01
@Kehrlann Kehrlann merged commit c49a994 into modelcontextprotocol:main May 28, 2026
21 checks passed
@Kehrlann
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

@joaodinissf joaodinissf deleted the fix/osgi-export-jackson-modules branch May 28, 2026 09:04
@Kehrlann Kehrlann added this to the 2.0.0-RC1 milestone May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/client area/server bug Something isn't working P2 Moderate issues affecting some users, edge cases, potentially valuable feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants